#ifndef _USART2_H
#define _USART2_H
#include "stdio.h"
#include "at32f435_437.h"
#include "string.h"
#include "at32f435_437_int.h"
#include "DistanceMeasure.h"
#include "Task_mpu.h"

#define UART5_GPIO_CRM_CLK          CRM_GPIOB_PERIPH_CLOCK
#define UART5_TX_PIN                GPIO_PINS_6
#define UART5_RX_PIN                GPIO_PINS_5
#define UART5_GPIO                  GPIOB


#define UART5_TX_PIN_SOURCE         GPIO_PINS_SOURCE6
#define UART5_RX_PIN_SOURCE         GPIO_PINS_SOURCE5
#define UART5_PIN_MUX_NUM        GPIO_MUX_8

#define USART_REC_LEN 200

#define RMC_DATA_LEN_T 75
#define RMC_DATA_LEN_F 45

#define GGA_DATA_LEN_T 78
#define GGA_DATA_LEN_F 40

void usart_dma_send(u8 *data,u16 len);
void project(void);

extern u8 Usart_Raw_Data[];
extern uint8_t Usart2_RXBuff[];

typedef struct {
	u8 Usart_Rx_Buf[USART_REC_LEN];	   //接收buf
	//u8 Usart_Rx_Baes_Buf[USART_REC_LEN];	   //接收buf
	u8 Usart_Tx_Buf[USART_REC_LEN];	   //接收buf
	u8 Usart_RMC_Buf[RMC_DATA_LEN_T];	   //RMC数据
	u8 Usart_GGA_Buf[GGA_DATA_LEN_T];	   //GGA数据
	u8 Usart_Flag;                     //是否有信号
	int Usart_Rx_Sta;					         //接收状态
	u16 Usart_Rx_Cut;					         //接收数据计数（长度）
	u16 Usart_Rx_Base_Cut;					         //接收数据计数（长度）
	u16 Usart_GGA_Cut;					         //发送数据长度
	u16 Usart_RMC_Cut;					         //发送数据长度
	int i;
} Uart5_TxRx_t;
 



//extern Usart2_TxRx_t Usart2_TxRx;


extern Uart5_TxRx_t *get_uart5_Communication_information(void);
void Uart2Send(uint8_t *buff,uint8_t size);
void uart2_init(uint32_t baudrate);

#endif
